﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="SearchRes.aspx.cs" Inherits="SearchRes" Title="餐馆搜索" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CPH_Main" runat="Server">
    <table style="width:100%">
        <tr>
            <td>
                餐馆名称：<asp:TextBox ID="txt_ResName" runat="server"></asp:TextBox>
                城市：<asp:DropDownList ID="dpl_City" runat="server" DataSourceID="ADS_City" DataTextField="R_sCity"
                    DataValueField="R_sCity">
                </asp:DropDownList>
                <asp:Button ID="btn_SearchOK" Text="搜索"  runat="server" OnClick="btn_SearchOK_Click"/>
            </td>
        </tr>
        <tr>
            <td>
                <asp:GridView ID="gdv_Res" runat="server" AutoGenerateColumns="False" BackColor="White"
                    BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataKeyNames="R_nID"
                    DataSourceID="ADS_Res" GridLines="Horizontal">
                    <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
                    <Columns>
                        <asp:BoundField DataField="R_nID" HeaderText="编号" InsertVisible="False" ReadOnly="True"
                            SortExpression="R_nID" />
                        <asp:BoundField DataField="R_sName" HeaderText="餐馆名" SortExpression="R_sName" />
                        <asp:BoundField DataField="R_sTel" HeaderText="联系电话" SortExpression="R_sTel" />
                        <asp:BoundField DataField="R_sCity" HeaderText="城市" />
                        <asp:BoundField DataField="R_sAddress" HeaderText="地址" SortExpression="R_sAddress" />
                        <asp:BoundField DataField="R_fMinCost" HeaderText="最低消费" SortExpression="R_fMinCost" />
                        <asp:BoundField DataField="R_fMaxCost" HeaderText="最高消费" SortExpression="R_fMaxCost" />
                        <asp:BoundField DataField="R_sDesc" HeaderText="说明" SortExpression="R_sDesc" />
                        <asp:HyperLinkField DataNavigateUrlFields="R_nID"
                            HeaderText="订餐" DataNavigateUrlFormatString="SearchSeat.aspx?ID={0}" Text="搜索餐位" />
                    </Columns>
                    <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
                    <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
                    <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
                    <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
                    <AlternatingRowStyle BackColor="#F7F7F7" />
                    <EmptyDataTemplate>
                        对不起没有您所输入条件的数据！
                    </EmptyDataTemplate>
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td>
            </td>
        </tr>
    </table>
    <asp:AccessDataSource ID="ADS_City" runat="server" DataFile="~/App_Data/DB_NCI5.mdb"
        SelectCommand="SELECT DISTINCT R_sCity FROM Restaurant"></asp:AccessDataSource>
    <asp:AccessDataSource ID="ADS_SearchBoth" runat="server" DataFile="~/App_Data/DB_NCI5.mdb"
        SelectCommand="SELECT * FROM [Restaurant] WHERE (([R_sCity] = ?) AND ([R_sName] LIKE '%' + ? + '%'))">
        <SelectParameters>
            <asp:ControlParameter ControlID="dpl_City" Name="R_sCity" PropertyName="SelectedValue"
                Type="String" />
            <asp:ControlParameter ControlID="txt_ResName" Name="R_sName" PropertyName="Text"
                Type="String" />
        </SelectParameters>
    </asp:AccessDataSource>
    <asp:AccessDataSource ID="ADS_SearchCity" runat="server" DataFile="~/App_Data/DB_NCI5.mdb"
        SelectCommand="SELECT * FROM [Restaurant] WHERE ([R_sCity] = ?)">
        <SelectParameters>
            <asp:ControlParameter ControlID="dpl_City" Name="R_sCity" PropertyName="SelectedValue"
                Type="String" />
        </SelectParameters>
    </asp:AccessDataSource>
    <asp:AccessDataSource ID="ADS_Res" runat="server" DataFile="~/App_Data/DB_NCI5.mdb"
        SelectCommand="SELECT [R_sName], [R_sAddress], [R_sTel], [R_fMinCost], [R_fMaxCost], [R_sDesc], [R_nID], [R_sCity] FROM [Restaurant]">
    </asp:AccessDataSource>
</asp:Content>
